<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateOrganizationEmployeesTable extends Migration
{
    /**
     * Run the migrations.
     * 组织负责人设置表
     *
     * @return void
     */
    public function up()
    {
        Schema::create('organization_employees', function (Blueprint $table) {
            $table->Increments('id');
            $table->integer('organization_id')->unsigned()->comment('客户ID')->nullable();
            $table->foreign('organization_id')->references('id')->on('organizations')->onDelete('set null');
            $table->integer('employee_id')->unsigned()->comment('产品ID')->nullable();
            $table->foreign('employee_id')->references('id')->on('employees')->onDelete('set null');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('organization_employees');
    }
}
